#!/usr/bin/python
# -*- coding: utf-8 -*-
import urllib,urllib2,re,xbmcplugin,xbmcgui,xbmc
#import sys, os, os.path

#author:
#elypter
#-mail:elypter@yahoo.de

#description:
#This plugin is a simple search-plugin for www.divxstage.net
#
#-If you think something in this plugin needs to be changed, send an email

#version-history:
#1_b1:
#-first release
#-I cant imagine any missing feature, so i guess it will be also the final release


def check(url):
	if url.rfind("videoweed"):
		return 1
	else:
		return 0

def get_regexp():
	#print "checking zshare"
	#return "http\://www\.zshare\.net/(?:\?v\=|v/)([0-9a-zA-Z]{8})"
	return "http\://www\.videoweed\.com/file/([^<>]*?)"
def get_name():
	return "videoweed"
def join(id):
	return "http://www.videoweed.com/file/"+id+""

def get_link1(url):
	req = urllib2.Request(url)
	req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
	response = urllib2.urlopen(req)
	page=response.read()
	response.close()
	vurl=re.compile('file="([^<>]*?)"').findall(page)
	
	
	return ("got",vurl[0],'','','','','videoweed')
	
	#return ("got","http://www.zshare.net/videoplayer/player.php"+vurl[0],'','','','','zshare')
	
def get_link2(param,code):
	#should take the url that get_link1 returned
	#
	#returnes the video url
	#return ()

	return ("got",param,'','','','','videoweed')